#pragma once
//#include<algorithm>
#include "dhconfigsdk.h"
#include "dhnetsdk.h"
#include <string>
#include <QRect>
#include <QPoint>

class DaHuaDeviceManager
{
public:
    DaHuaDeviceManager();
    ~DaHuaDeviceManager();

    static void Init();
    static void CleanUp();

    static LLONG Login(const std::string &ip, unsigned int port, const std::string&user, const std::string&password);
    static void Logout(LLONG lLoginHandle);

    static LLONG RealPlay(LLONG lLoginHandle, HWND hWnd, int channel = 0);
    static void StopPlay(LLONG lRealHandle);

    static bool CapturePicture(LLONG lRealHandle, const std::string& file_path);

    static bool AbsolutePTZControl(LLONG lLoginHandle, double P, double T, double Z, int channel = 0);

    static bool PTZControl(LLONG lLoginHandle, int type, int speed, bool is_stop = false, int channel = 0);

    static bool Dh3DLocation(LLONG lLoginHandle, const QRect &rect, const QPoint&start_point, const QPoint &end_point, int channel = 0);

    static bool QueryPTZStatus(LLONG lLoginHandle, double &p, double &t, double &z, int channel = 0);

    static bool QueryFOVStatus(LLONG lLoginHandle, double &fHorizontalValue, double &fVerticalValue);

    static bool StartVideo(LLONG lRealHandle,const std::string& file_path);

    static bool StopVideo(LLONG lRealHandle);

    static bool LightControl(LLONG lLoginHandle, int channel, bool param1);

    static bool LampControl(LLONG lLoginHandle, int channel, bool param1);

    static bool Heater(LLONG lLoginHandle, NET_IN_CHECK_CLOUD_UPGRADER* pInParam, NET_OUT_CHECK_CLOUD_UPGRADER* pOutParam, int nWaitTime);

    static bool Fans(LLONG lLoginHandle, const NET_IN_GET_FAN_SPEED_EX* pstuInParam, NET_OUT_GET_FAN_SPEED_EX* pstuOutParam, int nWaitTime);
};